﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WebControl_Client_SeachPlan : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ListAndProcessData wsv = new ListAndProcessData();
        var stringtravel = wsv.StartTravelPlan();
        foreach (var item in stringtravel)
        {
            ddlStartLocation.Items.Add(item.Location);
        }
        var stringtravelend = wsv.EndTravelPlan();
        foreach (var item in stringtravelend)
        {
            ddlEndLocation.Items.Add(item.Location);
        }

        CalendarExtender1.StartDate = DateTime.Now;
        CalendarExtender1.SelectedDate = DateTime.Now;

    }

    protected void btnseachplan_Click(object sender, EventArgs e)
    {
        string starlocation = ddlStartLocation.SelectedItem.ToString();
        string endlocation =   ddlEndLocation.SelectedItem.ToString();
        DateTime datefull = DateTime.Parse(CalendarExtender1.SelectedDate.ToString());
        string dateplan = datefull.ToString("M/dd/yyyy");
        Response.Redirect("BookTicket_1.aspx?starlocation=" + starlocation + "&endlocation=" + endlocation + "&dateplan=" + dateplan);
    }

}